package cn.pxy.ysframework.web.Service.Impl;

import cn.pxy.ysframework.web.Entity.Favorite;
import cn.pxy.ysframework.web.Repository.IFavortieDao;
import cn.pxy.ysframework.web.Service.IFavoriteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FavoriteService implements IFavoriteService {
    @Autowired
    private IFavortieDao favortieDao;

    @Override
    public List<Favorite> findAllByAccountid(String accountid) {
        return favortieDao.findAllByAccountid(accountid);
    }

    @Override
    public Favorite CreateFavorite(String accountid, String cardid) {
        Favorite favorite = new Favorite();
        favorite.setAccountid(accountid);
        favorite.setCardid(cardid);
        return  favortieDao.save(favorite);
    }
}
